import { useSearchParams, useLocation } from "react-router-dom"

export default function Detail(){

    const [params, setParams] = useSearchParams()

    // 使用 useLication 也可以获得 search 参数
    const location = useLocation()
    // location 中有 search 属性，值即为 search 参数字符串
    console.log(location.search)

    return (
        <ul>
            <li>message_id: {params.get('id')}</li>
            <li>message_title: {params.get('title')}</li>
            <li>message_content: {params.get('message')}</li>
        </ul>
    )
}